<?php

include_once dirname(dirname(__FILE__)) . '/include/common.php';
$category_id = isset($_POST["category_id"]) ? intval($_POST["category_id"]) : 0;
$core = new core();
$category_list='';
$list_category_parent = $core->getCategoryByParentId($category_id);
if ($list_category_parent) {
    $category_list='<select class ="category_parent"><option  value="0" selected>Chọn category</option>';
    foreach ($list_category_parent as $category) {      
        $category_list.=' <option value="'. $category->category_id.'">'.$category->category_name.'</option>';
    }
    $category_list.='</select>';
}

echo json_encode(array('type' => 0, 'category_list'=>$category_list));
die;
?>
